package com.heima.article.feign;

import com.heima.article.service.ApArticleService;
import com.heima.feign.article.IArticleClient;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 陈辉
 * @data 2023 11:27
 */
@RestController
public class ArticleClient implements IArticleClient {
    @Autowired
    private ApArticleService apArticleService;

    @PostMapping("/api/v1/article/save")
    public ResponseResult saveOrUpdate(@RequestBody ArticleDto articleDto) {
       /*try {
            //人为模拟故障...
            Thread.sleep(1000000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
        return apArticleService.saveArticle(articleDto);
    }
}
